# RootFind
include Makefile.config
SRCS= $(wildcard *.cpp)
LIBNAME= RootFind
INCDIR=
DEFINES += $(MATH_DEFINES)

STD_INCLUDES= /usr/include/
STD_LIBS=
PY_INCLUDES= /usr/include/python2.6/
PY_LIBDIR= /usr/lib/
#PY_INCLUDES= /l/python2.7/include/python2.7/
#PY_LIBDIR= /l/python2.7/lib/
LIBS= $(STD_LIBS) $(PY_LIBS) $(KRIS_LIBS)

INCDIR = $(PY_INCLUDES)

include Makefile.template

SWIG = swig

#SO_FLAGS = -dynamiclib
SO_FLAGS = -shared

PY_LIB = python2.6
#PY_LIB = python2.6.dll

.PHONY: clean lib

default: lib
	@echo Done.

rootfind_wrap.o: rootfind_wrap.cxx
	g++ -Wall -fPIC rootfind_wrap.cxx -o $(OBJDIR)/rootfind_wrap.o -I$(PY_INCLUDES) -c

rootfind_wrap.cxx: rootfind.i rootfind.h pyerr.h
	$(SWIG) -c++ -python rootfind.i

clean:
	-rm -rf $(OBJDIR)
	-rm rootfind_wrap.cxx
	-rm _rootfind.so

lib: $(OBJS) rootfind_wrap.o
	g++ -Wall $(SO_FLAGS) $(addprefix $(OBJDIR)/,$(OBJS)) $(OBJDIR)/rootfind_wrap.o -L$(PY_LIBDIR) -l$(PY_LIB) -o _rootfind.so

cygwin: lib
	cp _rootfind.so _rootfind.dll

